import request from "@/utils/request";
import { AxiosPromise } from "axios";
import {SysAppVersionForm, SysAppVersionQuery} from "@/api/appVersion/types";

/**
* APP版本表数据
*
* @param queryParams
*/
export function getSysAppVersionPage(
queryParams: SysAppVersionQuery
): AxiosPromise<PageResult<[]>> {
return request({
url: '/api/v1/appVersion/page',
method: 'get',
params: queryParams
});
}


/**
* 获取APP版本表表单数据
*
* @param queryParams
*/
export function getSysAppVersionForm(id: number): AxiosPromise<SysAppVersionForm> {
    return request({
    url: '/api/v1/appVersion/' + id + '/form',
    method: 'get'
    });
    }

    /**
    * 保存APP版本表
    *
    * @param data
    */
    export function saveSysAppVersion(data: SysAppVersionForm) {
    return request({
    url: "/api/v1/appVersion",
    method: "post",
    data: data,
    });
    }

    /**
    * 删除APP版本表
    *
    * @param ids
    */
    export function deleteSysAppVersion(ids: string) {
        return request({
        url: '/api/v1/appVersion/' + ids,
        method: 'delete'
        });
    }

    /**
    * 导入APP版本表
    *
    * @param file
    */
    export function importSysAppVersion(file: any) {
        const formData = new FormData();
        formData.append('file', file);
        return request({
            url: '/api/v1/appVersion/sysAppVersionImport',
            method: 'post',
            data: formData,
            headers: {
                'Content-Type': 'multipart/form-data'
            }
        });
    }

    /**
    * 导出APP版本表
    *
    * @param ids
    * @returns
    */
    export function exportSysAppVersion(ids: any) {
        return request({
            url: '/api/v1/appVersion/_export?ids='+ids,
            method: 'get',
            responseType: 'arraybuffer'
        });
    }